<!DOCTYPE html>












  


<html class="theme-next pisces use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">






















<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=6.6.0" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=6.6.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=6.6.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=6.6.0">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=6.6.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Pisces',
    version: '6.6.0',
    sidebar: {"position":"right","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="持续更新……  Unity内置的变换矩阵   变量名 描述     UNITY_MATRIX_MVP 当前的模型·观察·投影矩阵，用于将顶点/方向矢量从模型空间变换到裁剪空间   UNITY_MATRIX_MV 当前的模型·观察矩阵，用于将顶点顶点/方向矢量从模型空间变换到观察空间   UNITY_MATRIX_V 当前的观察矩阵，用于将顶点顶点/方向矢量从世界空间变换到观察空间   UNITY_">
<meta name="keywords" content="Unity,Shader">
<meta property="og:type" content="article">
<meta property="og:title" content="Unity ShaderLab常用变量·语义·函数速查表">
<meta property="og:url" content="https://glegoo.gitee.io/blog/2019/01/09/Unity-ShaderLab-速查表/index.html">
<meta property="og:site_name" content="glegoo">
<meta property="og:description" content="持续更新……  Unity内置的变换矩阵   变量名 描述     UNITY_MATRIX_MVP 当前的模型·观察·投影矩阵，用于将顶点/方向矢量从模型空间变换到裁剪空间   UNITY_MATRIX_MV 当前的模型·观察矩阵，用于将顶点顶点/方向矢量从模型空间变换到观察空间   UNITY_MATRIX_V 当前的观察矩阵，用于将顶点顶点/方向矢量从世界空间变换到观察空间   UNITY_">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-01-09T02:32:48.316Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Unity ShaderLab常用变量·语义·函数速查表">
<meta name="twitter:description" content="持续更新……  Unity内置的变换矩阵   变量名 描述     UNITY_MATRIX_MVP 当前的模型·观察·投影矩阵，用于将顶点/方向矢量从模型空间变换到裁剪空间   UNITY_MATRIX_MV 当前的模型·观察矩阵，用于将顶点顶点/方向矢量从模型空间变换到观察空间   UNITY_MATRIX_V 当前的观察矩阵，用于将顶点顶点/方向矢量从世界空间变换到观察空间   UNITY_">



  <link rel="alternate" href="/blog/atom.xml" title="glegoo" type="application/atom+xml">




  <link rel="canonical" href="https://glegoo.gitee.io/blog/2019/01/09/Unity-ShaderLab-速查表/">



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>Unity ShaderLab常用变量·语义·函数速查表 | glegoo</title>
  






  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?eba657066bacb7bc0148825c27994b83";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>






  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-right page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">glegoo</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">blog</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    

    <a href="/blog/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    

    <a href="/blog/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    

    <a href="/blog/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://glegoo.gitee.io/blog/blog/2019/01/09/Unity-ShaderLab-速查表/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="glegoo">
      <meta itemprop="description" content="chengwei1123@gmail.com">
      <meta itemprop="image" content="/blog/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="glegoo">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Unity ShaderLab常用变量·语义·函数速查表
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-01-09 09:18:49 / 修改时间：10:32:48" itemprop="dateCreated datePublished" datetime="2019-01-09T09:18:49+08:00">2019-01-09</time>
            

            
              

              
            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>持续更新……</p>
<hr>
<h2 id="Unity内置的变换矩阵"><a href="#Unity内置的变换矩阵" class="headerlink" title="Unity内置的变换矩阵"></a>Unity内置的变换矩阵</h2><table>
<thead>
<tr>
<th>变量名</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>UNITY_MATRIX_MVP</td>
<td>当前的模型·观察·投影矩阵，用于将顶点/方向矢量从模型空间变换到裁剪空间</td>
</tr>
<tr>
<td>UNITY_MATRIX_MV</td>
<td>当前的模型·观察矩阵，用于将顶点顶点/方向矢量从模型空间变换到观察空间</td>
</tr>
<tr>
<td>UNITY_MATRIX_V</td>
<td>当前的观察矩阵，用于将顶点顶点/方向矢量从世界空间变换到观察空间</td>
</tr>
<tr>
<td>UNITY_MATRIX_P</td>
<td>当前的观察矩阵，用于将顶点顶点/方向矢量从观察空间变换到裁剪空间</td>
</tr>
<tr>
<td>UNITY_MATRIX_VP</td>
<td>当前的观察·投影矩阵，用于将顶点顶点/方向矢量从世界空间变换到裁剪空间</td>
</tr>
<tr>
<td>UNITY_MATRIX_T_MV</td>
<td>UNITY_MATRIX_MV 的转置矩阵</td>
</tr>
<tr>
<td>UNITY_MATRIX_IT_MV</td>
<td>UNITY_MATRIX_MV 的逆转置矩阵，用于将法线从模型空间变换到观察空间，也可用于得到 UNITY_MATRIX_MV 的逆矩阵</td>
</tr>
<tr>
<td>_Object2World</td>
<td>当前的模型矩阵，用于将顶点顶点/方向矢量从模型空间变换到世界空间</td>
</tr>
<tr>
<td>_World2Object</td>
<td>_Object2World的逆矩阵，用于将顶点顶点/方向矢量从世界空间变换到模型空间</td>
</tr>
</tbody>
</table>
<a id="more"></a>
<h2 id="Unity-内置的摄像机和屏幕参数"><a href="#Unity-内置的摄像机和屏幕参数" class="headerlink" title="Unity 内置的摄像机和屏幕参数"></a>Unity 内置的摄像机和屏幕参数</h2><table>
<thead>
<tr>
<th>变量名</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>_WorldSpaceCameraPos</td>
<td>float3</td>
<td>该摄像机在世界空间中的位置</td>
</tr>
<tr>
<td>_ProjectionParams</td>
<td>float4</td>
<td>x = 1.0 (或-1.0，如果正在使用一个翻转的投影矩阵进行渲染)，y = Near，z = Far，w = 1.0 + 1.0/Far，其中 Near 和 Far 分别是近裁剪平面和远裁剪平面和摄像机的距离</td>
</tr>
<tr>
<td>_ScreenParams</td>
<td>float4</td>
<td>x = width，y = height，z = 1.0 + 1.0/width，w = 1.0 + 1.0/height，其中 width 和 height 分别是该摄像机的渲染目标( render target )的像素宽度和高度</td>
</tr>
<tr>
<td>_ZBufferParams</td>
<td>float4</td>
<td>x = 1 - Far/Near，y = Far/Near，z = x/Far，w = y/Far，该变量用于线性化Z缓存中的深度值</td>
</tr>
<tr>
<td>unity_OrthoParams</td>
<td>float4</td>
<td>x = width，y = height，z没有定义，w = 1.0（该摄像机是正交摄像机）或 w = 0.0（该摄像机是透视摄像机），其中 width 和 height 是正交投影摄像机的宽度和高度</td>
</tr>
<tr>
<td>unity_CameraProjection</td>
<td>float4x4</td>
<td>该摄像机的投影矩阵</td>
</tr>
<tr>
<td>unity_CameraInvProjection</td>
<td>float4x4</td>
<td>该摄像机的投影矩阵的逆矩阵</td>
</tr>
<tr>
<td>unity_CameraWorldClipPlanes[6]</td>
<td>float4</td>
<td>该摄像机的6个裁剪平面在世界空间下的等式，按如下顺序：左、右、下、上、近、远裁剪平面</td>
</tr>
</tbody>
</table>
<h2 id="ShaderLab-中属性的类型和-CG-变量类型的匹配关系"><a href="#ShaderLab-中属性的类型和-CG-变量类型的匹配关系" class="headerlink" title="ShaderLab 中属性的类型和 CG 变量类型的匹配关系"></a>ShaderLab 中属性的类型和 CG 变量类型的匹配关系</h2><table>
<thead>
<tr>
<th>ShaderLab 属性类型</th>
<th>CG 变量类型</th>
</tr>
</thead>
<tbody>
<tr>
<td>Color, Vector</td>
<td>float4, half4, fixed4</td>
</tr>
<tr>
<td>Range, Float</td>
<td>float, half, fixed</td>
</tr>
<tr>
<td>2D</td>
<td>sampler2D</td>
</tr>
<tr>
<td>Cube</td>
<td>samplerCube</td>
</tr>
<tr>
<td>3D</td>
<td>sampler3D</td>
</tr>
</tbody>
</table>
<h2 id="Unity-中一些常用的包含文件"><a href="#Unity-中一些常用的包含文件" class="headerlink" title="Unity 中一些常用的包含文件"></a>Unity 中一些常用的包含文件</h2><table>
<thead>
<tr>
<th>文件名</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>UnityCG.cginc</td>
<td>包含了最常使用的帮主函数、宏和结构体等</td>
</tr>
<tr>
<td>UnityShaderVariables.cginc</td>
<td>在编译 Unity Shader 时，会被自动包含金来，包含了许多内置的全局变量，如UNITY_MATRIX_MVP等</td>
</tr>
<tr>
<td>Lighting.cginc</td>
<td>包含了各种内置的光照模型，如果编写的是 Surface Shader 的话，会自动包含进来</td>
</tr>
<tr>
<td>HLSLSupport.cginc</td>
<td>在编译 Unity Shader 时，会被自动包含进来，生命了很多用于跨平台编译的宏和定义</td>
</tr>
</tbody>
</table>
<h2 id="UnityCG-cginc-中的一些常用的结构体"><a href="#UnityCG-cginc-中的一些常用的结构体" class="headerlink" title="UnityCG.cginc 中的一些常用的结构体"></a>UnityCG.cginc 中的一些常用的结构体</h2><table>
<thead>
<tr>
<th>名称</th>
<th>描述</th>
<th>包含的变量</th>
</tr>
</thead>
<tbody>
<tr>
<td>appdata_base</td>
<td>可用于顶点着色器的输入</td>
<td>顶点位置、顶点法线、第一组纹理坐标</td>
</tr>
<tr>
<td>appdata_tan</td>
<td>可用于顶点着色器的输入</td>
<td>顶点位置、顶点切线、顶点法线、第一组纹理坐标</td>
</tr>
<tr>
<td>appdata_full</td>
<td>可用于顶点着色器的输入</td>
<td>顶点位置、顶点切线、顶点法线、四组（或更多）纹理坐标</td>
</tr>
<tr>
<td>appdata_img</td>
<td>可用于顶点着色器的输入</td>
<td>顶点位置、第一组纹理坐标</td>
</tr>
<tr>
<td>v2f_img</td>
<td>可用于顶点着色器的输入</td>
<td>裁剪空间中的位置、纹理坐标</td>
</tr>
</tbody>
</table>
<h2 id="UnityCG-cginc-中的一些常用的帮助函数"><a href="#UnityCG-cginc-中的一些常用的帮助函数" class="headerlink" title="UnityCG.cginc 中的一些常用的帮助函数"></a>UnityCG.cginc 中的一些常用的帮助函数</h2><table>
<thead>
<tr>
<th>函数名</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>float3 WorldSpaceViewDir (float4 v)</td>
<td>输入一个模型空间中的顶点位置，返回世界空间中从该点到摄像机的观察方向</td>
</tr>
<tr>
<td>float3 ObjSpaceViewDir (float4 v)</td>
<td>输入一个模型空间中的顶点位置，返回模型空间中从该点到摄像机的观察方向</td>
</tr>
<tr>
<td>float3 WorldSpaceLightDir (float4 v)</td>
<td><strong>仅可用于前向渲染中</strong>，输入一个模型空间中的顶点位置，返回世界空间中从该点到光源的光照方向，没有被归一化</td>
</tr>
<tr>
<td>float3 ObjSpaceLightDir (float4 v)</td>
<td><strong>仅可用于前向渲染中</strong>，输入一个模型空间中的顶点位置，返回模型空间中从该点到光源的光照方向，没有被归一化</td>
</tr>
<tr>
<td>float3 UnityObjectToWorldNormal (float3 norm)</td>
<td>把法线方向从模型空间转换到世界空间中</td>
</tr>
<tr>
<td>float3 UnityObjectToWorldDir (float3 norm)</td>
<td>把方向矢量从模型空间变换到世界空间中</td>
</tr>
<tr>
<td>float3 UnityWorldToObjectDir (float3 norm)</td>
<td>把方向矢量从世界空间变换到模型空间中</td>
</tr>
</tbody>
</table>
<h2 id="从应用阶段传递模型数据给顶点着色器时-Unity-支持的常用语义"><a href="#从应用阶段传递模型数据给顶点着色器时-Unity-支持的常用语义" class="headerlink" title="从应用阶段传递模型数据给顶点着色器时 Unity 支持的常用语义"></a>从应用阶段传递模型数据给顶点着色器时 Unity 支持的常用语义</h2><table>
<thead>
<tr>
<th>语义</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>POSITION</td>
<td>模型空间中的顶点位置，通常是 float4 类型</td>
</tr>
<tr>
<td>NORMAL</td>
<td>顶点法线，通常是 float3 类型</td>
</tr>
<tr>
<td>TANGENT</td>
<td>顶点切线，通常是 float4 类型</td>
</tr>
<tr>
<td>TEXCOORDn，如 TEXCOORD0、TEXCOORD1</td>
<td>该顶点的纹理坐标，TEXCOORD0 表示第一组纹理坐标，以此类推，通常是 float2 或 float4 类型</td>
</tr>
<tr>
<td>COLOR</td>
<td>顶点颜色，通常是 fixed4或float4 类型</td>
</tr>
</tbody>
</table>
<h2 id="从顶点着色器传递数据给片元着色器时-Unity-使用的常用语义"><a href="#从顶点着色器传递数据给片元着色器时-Unity-使用的常用语义" class="headerlink" title="从顶点着色器传递数据给片元着色器时 Unity 使用的常用语义"></a>从顶点着色器传递数据给片元着色器时 Unity 使用的常用语义</h2><table>
<thead>
<tr>
<th>语义</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>SV_POSITION</td>
<td>裁剪空间中的顶点坐标，结构体重必须包含一个用该语义修饰的变量。等同于 DirectX 9 中的 POSITION，但最好使用 SV_POSITION</td>
</tr>
<tr>
<td>COLOR0</td>
<td>通常用于输出第一组顶点颜色，但不是必需的</td>
</tr>
<tr>
<td>COLOR1</td>
<td>通常用于输出第二组顶点颜色，但不是必需的</td>
</tr>
<tr>
<td>TEXCOORD0~TEXCOORD7</td>
<td>通常用于输出纹理坐标，但不是必需的</td>
</tr>
</tbody>
</table>
<h2 id="片元着色器输出时-Unity-支持的常用语义"><a href="#片元着色器输出时-Unity-支持的常用语义" class="headerlink" title="片元着色器输出时 Unity 支持的常用语义"></a>片元着色器输出时 Unity 支持的常用语义</h2><table>
<thead>
<tr>
<th>语义</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>SV_Target</td>
<td>输出值将会存储到渲染目标 (render target) 中。等同于 DirectX 9 中的 COLOR语义，但最好使用 SV_Target</td>
</tr>
</tbody>
</table>
<hr>
<h3 id="参考文献"><a href="#参考文献" class="headerlink" title="参考文献"></a>参考文献</h3><ol>
<li>冯乐乐，《Unity Shader入门精要》</li>
</ol>

      
    </div>

    

    
    
    

    

    
       
    
    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/blog/images/pay/wechat.png" alt="glegoo 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/blog/images/pay/alipay.png" alt="glegoo 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/Unity/" rel="tag"># Unity</a>
          
            <a href="/blog/tags/Shader/" rel="tag"># Shader</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2019/01/07/上传苹果商店authenticating-with-the-itunes-store问题解决方案/" rel="next" title="上传苹果商店authenticating with the itunes store问题解决方案">
                <i class="fa fa-chevron-left"></i> 上传苹果商店authenticating with the itunes store问题解决方案
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="comments">
      <div id="lv-container" data-id="city" data-uid="MTAyMC80MTg3NS8xODQyMQ=="></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/blog/images/avatar.jpg" alt="glegoo">
            
              <p class="site-author-name" itemprop="name">glegoo</p>
              <p class="site-description motion-element" itemprop="description">chengwei1123@gmail.com</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/blog/archives/">
                
                    <span class="site-state-item-count">3</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/blog/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">8</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/blog/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://github.com/glegoo" title="GitHub &rarr; https://github.com/glegoo" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="mailto:chengwei1123@gmail.com" title="E-Mail &rarr; mailto:chengwei1123@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://www.zhihu.com/people/glegoo/activities" title="知乎 &rarr; https://www.zhihu.com/people/glegoo/activities" rel="noopener" target="_blank"><i class="fa fa-fw fa-知乎"></i>知乎</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://www.douban.com/people/54250291" title="豆瓣 &rarr; https://www.douban.com/people/54250291" rel="noopener" target="_blank"><i class="fa fa-fw fa-豆瓣"></i>豆瓣</a>
                </span>
              
            </div>
          

          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Unity内置的变换矩阵"><span class="nav-number">1.</span> <span class="nav-text">Unity内置的变换矩阵</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Unity-内置的摄像机和屏幕参数"><span class="nav-number">2.</span> <span class="nav-text">Unity 内置的摄像机和屏幕参数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#ShaderLab-中属性的类型和-CG-变量类型的匹配关系"><span class="nav-number">3.</span> <span class="nav-text">ShaderLab 中属性的类型和 CG 变量类型的匹配关系</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Unity-中一些常用的包含文件"><span class="nav-number">4.</span> <span class="nav-text">Unity 中一些常用的包含文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#UnityCG-cginc-中的一些常用的结构体"><span class="nav-number">5.</span> <span class="nav-text">UnityCG.cginc 中的一些常用的结构体</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#UnityCG-cginc-中的一些常用的帮助函数"><span class="nav-number">6.</span> <span class="nav-text">UnityCG.cginc 中的一些常用的帮助函数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#从应用阶段传递模型数据给顶点着色器时-Unity-支持的常用语义"><span class="nav-number">7.</span> <span class="nav-text">从应用阶段传递模型数据给顶点着色器时 Unity 支持的常用语义</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#从顶点着色器传递数据给片元着色器时-Unity-使用的常用语义"><span class="nav-number">8.</span> <span class="nav-text">从顶点着色器传递数据给片元着色器时 Unity 使用的常用语义</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#片元着色器输出时-Unity-支持的常用语义"><span class="nav-number">9.</span> <span class="nav-text">片元着色器输出时 Unity 支持的常用语义</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#参考文献"><span class="nav-number">9.1.</span> <span class="nav-text">参考文献</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">glegoo</span>

  

  
</div>


  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.8.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v6.6.0</div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>
















  
  



  
  



  
  







  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/three/three-waves.min.js"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/three/canvas_lines.min.js"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/three/canvas_sphere.min.js"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=6.6.0"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=6.6.0"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=6.6.0"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=6.6.0"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=6.6.0"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=6.6.0"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=6.6.0"></script>



  



  
    <script type="text/javascript">
      window.livereOptions = {
        refer: '2019/01/09/Unity-ShaderLab-速查表/'
      };
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  










  





  

  

  

  

  

  
  

  

  

  

  

  

  

</body>
</html>
